Add per-workbook RenderContext on ExcelWorkbook#2395
Open
swmal wants to merge 98 commits into
Open
Conversation
…EPPlusSoftware/EPPlus into feature/DrawingRendererRefactor
…EPPlusSoftware/EPPlus into feature/DrawingRendererRefactor
…EPPlusSoftware/EPPlus into feature/DrawingRendererRefactor
…EPPlusSoftware/EPPlus into feature/DrawingRendererRefactor
…EPPlusSoftware/EPPlus into feature/DrawingRendererRefactor
…EPPlusSoftware/EPPlus into feature/DrawingRendererRefactor
…EPPlusSoftware/EPPlus into feature/DrawingRendererRefactor
…EPPlusSoftware/EPPlus into feature/DrawingRendererRefactor
…EPPlusSoftware/EPPlus into feature/DrawingRendererRefactor
…EPPlusSoftware/EPPlus into feature/DrawingRendererRefactor
…er stack; split FontAvailability into result enum plus RequireExactFont policy
… the SVG export pipeline for charts and shapes, replacing the global OpenTypeFonts singleton; split FontAvailability into a result enum plus RequireExactFont policy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace global font singleton with per-workbook RenderContext
Background
The SVG export pipeline for charts and shapes resolved fonts through the global
OpenTypeFontssingleton. This leaked global state into the render stack, prevented per-workbook font configuration, and made test isolation difficult.Changes
Introduces a per-workbook
RenderContext(holding the font engine), owned lazily byExcelWorkbookand threaded through the render hierarchy —DrawingRenderer, text bodies, paragraph render items, and down toLayoutSystem/TextLayoutEngine. This mirrors theParsingContextpattern used in formula calculation.Nodes that have a workbook (e.g.
DrawingRenderer,DrawingTextBox) fetch the context from it; nodes that don't receive it via constructor. The chart branch reaches it throughChartDrawingObject.RenderContext.Public API:
Workbook.ConfigureFonts(Action<IEpplusFontConfiguration>)for users (no class/constructor knowledge required);UseFontEngineinternal for tests.Also cleans up
FontAvailability: it is now a pure result enum (NotFound,FamilyOnly,Exact), with strictness moved to a separateRequireExactFontflag defaulting tofalse— rendering trusts the fallback chain and no longer throws on a missing theme font.TextLayoutEnginenow carries anOpenTypeFontEnginedirectly, removing an abstraction-breaking cast and the last singleton fallback in the layout path.